function body_onload() {
    setInterval(UpdateMatrixFromServer, 5000);
}



function hello()
{
	alert('hello cruel world');
}

function GetSmth() {

    return;
	var playerID = 1;
	var json1 = JSON.stringify(playerID);

	var serviceUrl = "http://" + document.location.host + "/TripleGamesService.svc/GetGameMatrixState";

    //var theUrl
	
	$.ajax(
	{
		async: true,
		type: "POST",
		url: serviceUrl,
		data: json1,
		dataType: "json",
		contentType: "application/json;charset=utf-8",
		success: function (response) 
		{
			if (typeof response != "undefined")
			{
				//$("#out").append("HTTP POST response:<br/>" + response + "<br/>");
				alert(response);
			}
			else
			{
				alert('faiill');
			}						
		},
		error: function()
		{
			alert('error');
		}
    });

}

var playerID = 1;

function UpdateMatrixFromServer() 
{        
    var playerIdJson = JSON.stringify(playerID);

    var serviceUrl = "http://" + document.location.host + "/TripleGamesService.svc/GetGameMatrix";
        
    $.ajax(
	{
	    async: true,
	    type: "POST",
	    url: serviceUrl,
	    data: playerIdJson,
	    dataType: "json",
	    contentType: "application/json;charset=utf-8",
	    success: function (response) 
        {
            if (typeof response != "undefined") 
            {	            
	            UpdateMatrix(response);
	        }
	        else 
            {
	            alert('faiill');
	        }
	    },
	    error: function () 
        {
	        alert('error');
	    }
	});

}

function UpdateMatrix(matrix) 
{
    for (var i = 0; i < 50; i++) 
    {
        var divID = 'Div' + i;
        var div = $('#' + divID);
        div.text ( matrix[i]);
    }
}